Results and Error Handling

Lua has 2 complementary styles. For expected failures, we can return multiples from the function. For errors that violates contracts, programming mistakes, or cannot be handled by current function, use assert() or error() to explicitly raise errors.

To catch an error, we should use pcall.

To catch an error along with the traceback, use xpcall.

Date: 2026-08-14 Fri

Author: ArcaLunar